Skip to content

[ty] Selectively promote a union of homogenously-typed, fixed-length tuples of differing lengths to a single, variable-length tuple.#24705

Draft
lerebear wants to merge 1 commit intomainfrom
lerebear/push-trkuowqxsnyq
Draft

[ty] Selectively promote a union of homogenously-typed, fixed-length tuples of differing lengths to a single, variable-length tuple.#24705
lerebear wants to merge 1 commit intomainfrom
lerebear/push-trkuowqxsnyq

Conversation

@lerebear
Copy link
Copy Markdown
Contributor

Summary

Closes astral-sh/ty#2620.

Test Plan

Please see new and updated mdtests.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Apr 18, 2026
@lerebear lerebear changed the title Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Promote unions of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 18, 2026
@lerebear lerebear changed the title Promote unions of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 18, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 18, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 88.70%. The percentage of expected errors that received a diagnostic held steady at 84.63%. The number of fully passing files held steady at 84/134.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 18, 2026

Memory usage report

Summary

Project Old New Diff Outcome
sphinx 258.91MB 258.97MB +0.03% (68.70kB)
prefect 702.93MB 702.95MB +0.00% (28.91kB)
flake8 47.64MB 47.64MB +0.01% (7.08kB)
trio 116.60MB 116.60MB +0.00% (276.00B)

Significant changes

Click to expand detailed breakdown

sphinx

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 1.90MB 1.93MB +1.35% (26.22kB)
Specialization 1001.14kB 1009.56kB +0.84% (8.42kB)
GenericAlias 417.38kB 422.79kB +1.30% (5.41kB)
TupleType<'db>::to_class_type_ 147.57kB 152.87kB +3.59% (5.30kB)
StaticClassLiteral<'db>::try_mro_::interned_arguments 444.16kB 449.37kB +1.17% (5.20kB)
is_redundant_with_impl 927.43kB 932.45kB +0.54% (5.02kB)
is_redundant_with_impl::interned_arguments 1.07MB 1.08MB +0.45% (4.98kB)
infer_expression_types_impl 20.83MB 20.83MB +0.02% (3.64kB)
IntersectionType 462.84kB 464.31kB +0.32% (1.48kB)
UnionType 461.67kB 462.94kB +0.27% (1.27kB)
function_known_decorators 1.12MB 1.12MB +0.08% (924.00B)
infer_definition_types 23.80MB 23.80MB +0.00% (492.00B)
infer_deferred_types 5.27MB 5.27MB +0.01% (384.00B)

prefect

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 4.26MB 4.27MB +0.21% (8.95kB)
function_known_decorators 4.55MB 4.55MB +0.11% (5.06kB)
infer_definition_types 90.03MB 90.03MB +0.00% (2.67kB)
Specialization 2.12MB 2.12MB +0.11% (2.47kB)
StaticClassLiteral<'db>::try_mro_::interned_arguments 1.05MB 1.05MB +0.16% (1.76kB)
GenericAlias 909.91kB 911.46kB +0.17% (1.55kB)
Type<'db>::member_lookup_with_policy_ 17.31MB 17.31MB +0.01% (1.44kB)
infer_deferred_types 11.14MB 11.14MB +0.01% (1.41kB)
infer_expression_types_impl 63.84MB 63.84MB +0.00% (1.05kB)
Type<'db>::member_lookup_with_policy_::interned_arguments 5.97MB 5.97MB +0.01% (832.00B)
TupleType<'db>::to_class_type_ 463.61kB 464.23kB +0.13% (632.00B)
infer_scope_types_impl 55.66MB 55.66MB +0.00% (444.00B)
is_redundant_with_impl 2.00MB 2.00MB +0.01% (228.00B)
infer_unpack_types 973.44kB 973.63kB +0.02% (192.00B)
is_redundant_with_impl::interned_arguments 2.12MB 2.12MB +0.01% (176.00B)
... 1 more

flake8

Name Old New Diff Outcome
StaticClassLiteral<'db>::try_mro_ 306.84kB 310.34kB +1.14% (3.50kB)
Specialization 156.56kB 157.66kB +0.70% (1.09kB)
GenericAlias 67.92kB 68.62kB +1.04% (720.00B)
StaticClassLiteral<'db>::try_mro_::interned_arguments 70.10kB 70.80kB +1.00% (720.00B)
function_known_decorators 179.68kB 180.17kB +0.27% (504.00B)
TupleType<'db>::to_class_type_ 13.21kB 13.62kB +3.13% (424.00B)
infer_definition_types 1.84MB 1.84MB +0.01% (180.00B)

trio

Name Old New Diff Outcome
infer_expression_types_impl 7.01MB 7.01MB +0.00% (108.00B)
infer_scope_types_impl 4.73MB 4.73MB +0.00% (72.00B)
infer_definition_types 7.69MB 7.69MB +0.00% (48.00B)
function_known_decorators 350.89kB 350.91kB +0.01% (24.00B)
infer_deferred_types 2.34MB 2.34MB +0.00% (24.00B)

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 18, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 0 1 25
index-out-of-bounds 0 2 0
invalid-assignment 0 1 1
not-iterable 0 0 2
Total 0 4 28

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Raw diff (32 changes)
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- tests/contrib/pytest/test_pytest.py:66:19 error[index-out-of-bounds] Index 1 is out of bounds for tuple `tuple[str]` with length 1
- tests/contrib/pytest/test_pytest.py:75:46 error[invalid-argument-type] Argument to bound method `Span.get_tag` is incorrect: Expected `str`, found `Unknown | str | None`
+ tests/contrib/pytest/test_pytest.py:75:46 error[invalid-argument-type] Argument to bound method `Span.get_tag` is incorrect: Expected `str`, found `str | None`

jax (https://github.com/google/jax)
- jax/_src/internal_test_util/test_harnesses.py:1841:31 error[index-out-of-bounds] Index -1 is out of bounds for tuple `tuple[()]` with length 0

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- examples/contrib/jsondump.py:137:17 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]`, found `dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((s: Buffer, altchars: Buffer | None = None) -> bytes)]`
+ examples/contrib/jsondump.py:137:17 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]`, found `dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((s: Buffer, altchars: Buffer | None = None) -> bytes)]`
- examples/contrib/jsondump.py:182:20 error[not-iterable] Object of type `None | list[dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | tuple[tuple[str, str], tuple[str, str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]]` may not be iterable
+ examples/contrib/jsondump.py:182:20 error[not-iterable] Object of type `None | list[dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | <class 'dict'>] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((t) -> int)] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((addr) -> dict[str, Unknown])] | dict[str, tuple[tuple[str, str], ...] | tuple[tuple[str]] | ((ms) -> list[dict[str, Unknown | bytes | int]])]]` may not be iterable
- examples/contrib/jsondump.py:183:26 error[not-iterable] Object of type `tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str, str], tuple[str, str], tuple[str, str], tuple[str, str]] | tuple[tuple[str]] | ... omitted 5 union elements` may not be iterable
+ examples/contrib/jsondump.py:183:26 error[not-iterable] Object of type `tuple[tuple[str, str], ...] | tuple[tuple[str]] | <class 'dict'> | ... omitted 3 union elements` may not be iterable

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/SelfTest/Hash/test_SHA1.py:72:26 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `tuple[str, str] | tuple[str, str, str]`, found `tuple[bytes, Unknown | Literal[b""], Unknown]`
+ lib/Crypto/SelfTest/Hash/test_SHA1.py:72:26 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `tuple[str, ...]`, found `tuple[bytes, Unknown | Literal[b""], Unknown]`

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ sklearn/externals/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`

scipy (https://github.com/scipy/scipy)
- subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[complex]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[float]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`
- subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, str, str] | tuple[str, str]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, str, str] | tuple[str, str]]`
+ subprojects/array_api_extra/src/array_api_extra/_lib/_utils/_helpers.py:213:16 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]].__getitem__(key: <class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, /) -> str | tuple[str, ...]` cannot be called with key of type `type[int]` on object of type `dict[<class 'bool'> | <class 'int'> | <class 'float'> | <class 'complex'>, str | tuple[str, ...]]`

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/tests/test_build_ext.py:378:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["macros"]` and value of type `list[tuple[str, str] | tuple[str]]` on object of type `dict[str, list[str] | str | list[tuple[str, str, str] | str]]`
+ setuptools/_distutils/tests/test_build_ext.py:378:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["macros"]` and value of type `list[tuple[str, ...]]` on object of type `dict[str, list[str] | str | list[tuple[str, str, str] | str]]`

vision (https://github.com/pytorch/vision)
- test/test_datasets.py:698:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["trainval"]` and value of type `tuple[int, ...]` on object of type `dict[str, tuple[int, int, int] | tuple[int, int] | tuple[int]]`
- test/test_transforms_v2.py:1001:17 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1001:17 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1007:55 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1007:55 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1092:36 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1092:36 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1094:20 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | tuple[int] | None | tuple[int, int]`
+ test/test_transforms_v2.py:1094:20 error[invalid-argument-type] Argument to function `resize` is incorrect: Expected `list[int] | None`, found `int | list[int] | None | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `list[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1550:49 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `list[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1604:13 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1691:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `InterpolationMode | int`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `int | tuple[int | float, int | float] | tuple[int, ...]`
- test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, int, int, int]`
+ test/test_transforms_v2.py:1746:45 error[invalid-argument-type] Argument to `RandomAffine.__init__` is incorrect: Expected `Sequence[int | float] | None`, found `int | tuple[int | float, int | float] | tuple[int, ...]`

Full report with detailed diff (timing results)

@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch 2 times, most recently from d5e6069 to d427c69 Compare April 18, 2026 16:01
@lerebear lerebear changed the title Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. [ty] Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 21, 2026
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch 2 times, most recently from 6ffa440 to 24eb4cb Compare April 21, 2026 14:19
@lerebear lerebear changed the title [ty] Promote a union of homogenously-typed tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. [ty] Promote a union of homogenously-typed, fixed-length tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. Apr 21, 2026
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch 6 times, most recently from 23b7f84 to cdf2c2e Compare April 24, 2026 16:45
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 24, 2026

Merging this PR will degrade performance by 5.64%

❌ 1 regressed benchmark
✅ 52 untouched benchmarks
⏩ 60 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime colour_science 50.3 s 53.4 s -5.64%

Comparing lerebear/push-trkuowqxsnyq (3926566) with main (87443c2)

Open in CodSpeed

Footnotes

  1. 60 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch 3 times, most recently from f3eb780 to 4aece39 Compare April 24, 2026 19:23
@lerebear lerebear changed the title [ty] Promote a union of homogenously-typed, fixed-length tuples of differing lengths to a single, variable-length tuple when the type appears in an invariant position. [ty] Selectively promote a union of homogenously-typed, fixed-length tuples of differing lengths to a single, variable-length tuple. Apr 24, 2026
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch 3 times, most recently from eff49a5 to c11aeca Compare April 27, 2026 18:33
@lerebear lerebear force-pushed the lerebear/push-trkuowqxsnyq branch from c11aeca to 3926566 Compare April 28, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promote tuple size in invariant positions

1 participant